import request from '@/utils/request.js'
import successMp3 from '../static/mp3/success.wav'
import warningMp3 from '../static/mp3/warning.wav'
import errorMp3 from '../static/mp3/error.wav'




export const handleMediaPlayer = (type) => {
	let innerAudioContext = uni.createInnerAudioContext();
	innerAudioContext.autoplay = true;
	innerAudioContext.src = type === 'success' ? successMp3 : (type === 'warning' ? warningMp3 : errorMp3);
	innerAudioContext.onPlay();
	setTimeout(() => {
		innerAudioContext.destroy()
	}, 300)
	innerAudioContext.onError((res) => {
		innerAudioContext.destroy();
		innerAudioContext = uni.createInnerAudioContext();
	});
}


//用户登录
export function login(params){
	return request({
		url:'/admin/Login/index',
		method:'POST',
		data:params
	})
}

//生产入库单列表
export function getProInstosckDetail(params){
	return request({
		url:'/app/PrdInstock/get_prd_instock_detail',
		method:'POST',
		data:params
		
	})
}


//生产入库单详情(库管)
export function getProInstosckDetailKu(params){
	return request({
		url:'/app/PrdInstock/get_prd_instock_detail_ku',
		method:'POST',
		data:params
		
	})
}

//生产入库单详情(库管合托)
export function getProInstosckDetailKuMerge(params){
	return request({
		url:'/app/PrdInstock/get_prd_instock_detail_ku_merge',
		method:'POST',
		data:params
		
	})
}

//生产入库单详情(库管合托)
export function deleteMerge(params){
	return request({
		url:'/app/PrdInstock/delete_merge',
		method:'POST',
		data:params
		
	})
}
//生产入库单列表
export function getProInstocklist(params){
	return request({
		url:'/app/PrdInstock/get_proinstock_list',
		method:'POST',
		data:params
		
	})
}

//生产入库单质检列表
// export function getProInstocklistQuality(params){
// 	return request({
// 		url:'/app/PrdInstock/get_proinstock_list_quality',
// 		method:'POST',
// 		data:params
		
// 	})
// }


//收料通知单列表
export function getReceiveList(params){
	return request({
		url:'/app/Receive/get_receive_list_phone',
		method:'POST',
		data:params
		
	})
}


//来料检验单列表
export function getInspectList(params){
	return request({
		url:'/app/Inspect/get_inspect_list',
		method:'POST',
		data:params
		
	})
}
//其他人检验单列表
export function getOtherInspectList(params){
	return request({
		url:'/app/Otherinspect/get_other_inspect_list',
		method:'POST',
		data:params
		
	})
}

//其他入库检验单详情
export function otherInspectDetail(params){
	return request({
		url:'/app/Otherinspect/get_other_inspect_detail',
		method:'POST',
		data:params
		
	})
}

//修改检查单是否检查的状态
export function changeInspectIsChecked(params){
	return request({
		url:'/app/Inspect/change_inspect_isChecked',
		method:'POST',
		data:params
		
	})
}


//修改其他入检查单是否检查的状态
export function changeOtherInspectIsChecked(params){
	return request({
		url:'/app/Otherinspect/change_other_inspect_isChecked',
		method:'POST',
		data:params
		
	})
}


//来料检验单详情
export function inspectDetail(params){
	return request({
		url:'/app/Inspect/get_inspect_detail',
		method:'POST',
		data:params
		
	})
}

//审核来料检验单
export function auditInspect(params){
	return request({
		url:'/app/Inspect/audit_inspect',
		method:'POST',
		data:params
		
	})
}

//审核模具检查单
export function auditMoldInspect(params){
	return request({
		url:'/app/MoldInspect/audit_mold_inspect',
		method:'POST',
		data:params
		
	})
}

//审核其他检验单
export function auditOtherInspect(params){
	return request({
		url:'/app/Otherinspect/audit_other_inspect',
		method:'POST',
		data:params
		
	})
}

//获取用户信息
export function getUserInfo(params){
	return request({
		url:'/admin/Login/getUserInfo',
		method:'POST',
		data:params
	})
}


//获取收料通知单明细
export function getReceiveDetail(params){
	return request({
		url:'/app/Receive/get_receive_detail',
		method:'POST',
		data:params
		
	})
}

//生成来料检验单
export function saveInspect(params){
	return request({
		url:'/app/Inspect/save_inspect',
		method:'POST',
		data:params
		
	})
}

//获取采购入库单列表
export function getPurInList(params){
	return request({
		url:'/app/PurIn/get_pur_in_list',
		method:'POST',
		data:params
		
	})
}

//获取采购入库单详情
export function getPurInDetail(params){
	return request({
		url:'/app/PurIn/get_pur_in_detail',
		method:'POST',
		data:params
		
	})
}

//审核采购入库单
export function auditPurIn(params){
	return request({
		url:'/app/PurIn/audit_pur_in_pda',
		method:'POST',
		data:params
		
	})
}

//审核生产入库单
export function auditPrdIn(params){
	return request({
		url:'/app/PrdInstock/audit_prd_in',
		method:'POST',
		data:params
		
	})
}


//合并入库审核
export function auditPrdInMerge(params){
	return request({
		url:'/app/PrdInstock/audit_prd_in_merge',
		method:'POST',
		data:params
		
	})
}
//合托扫码
export function getInStockByTray(params){
	return request({
		url:'/app/PrdInstock/get_in_stock_by_tray',
		method:'POST',
		data:params
		
	})
}

//质检生产入库单
export function auditPrdInspect(params){
	return request({
		url:'/app/PrdInstock/audit_prd_inspect',
		method:'POST',
		data:params
		
	})
}

//=仓库列表所有
export function selectstock(params){
	return request({
		url:'/app/Warehouse/get_stock_list',
		method:'POST',
		data:params
		
	})
}

//选择仓库(根据用户)
export function getStockListByUser(params){
	return request({
		url:'/app/Warehouse/get_stock_list_by_user',
		method:'POST',
		data:params
		
	})
}

//判断仓库是否启用仓位
export function checkStock(params){
	return request({
		url:'/app/Warehouse/check_stock',
		method:'POST',
		data:params
		
	})
}

//根据仓库获取仓位
export function getLocation(params){
	return request({
		url:'/app/Warehouse/get_location',
		method:'POST',
		data:params
		
	})
}

//获取采购退料单列表
export function getPurReturnList(params){
	return request({
		url:'/app/PurReturn/get_pur_return_list',
		method:'POST',
		data:params
		
	})
}

//其他入库单列表
export function getOtherInList(params){
	return request({
		url:'/app/StkOtherIn/get_other_in_list',
		method:'POST',
		data:params
		
	})
}

//其他出库单列表
export function getOtherOutList(params){
	return request({
		url:'/app/Stkotherout/get_other_out_list',
		method:'POST',
		data:params
		
	})
}


//其他出库申请单列表
export function getStkApplyList(params){
	return request({
		url:'/app/Stkapply/get_stk_apply_list',
		method:'POST',
		data:params
		
	})
}

//其他出库申请单详情
export function getStkApplyDetail(params){
	return request({
		url:'/app/Stkapply/get_stk_apply_detail',
		method:'POST',
		data:params
		
	})
}

//调拨申请单列表
export function getStkTransferAppList(params){
	return request({
		url:'/app/StkTransferapp/get_stk_transfer_app_list',
		method:'POST',
		data:params
		
	})
}


//调拨申请单详情
export function getStkTransferAppDetail(params){
	return request({
		url:'/app/StkTransferapp/get_stk_transfer_app_detail',
		method:'POST',
		data:params
		
	})
}

//修改调拨申请详情数据
export function updateStkTransferAppDetail(params){
	return request({
		url:'/app/StkTransferapp/update_stk_transfer_app_detail',
		method:'POST',
		data:params
		
	})
}

//审核调拨申请单
export function auditStkTransferApp(params){
	return request({
		url:'/app/StkTransferapp/audit_stk_transfer_app',
		method:'POST',
		data:params
		
	})
}

//审核调拨申请单(包材)
export function auditStkTransferAppBaoCai(params){
	return request({
		url:'/app/StkTransferapp/audit_stk_transfer_app_bao_cai',
		method:'POST',
		data:params
		
	})
}

//审核其他出库申请
export function auditStkApply(params){
	return request({
		url:'/app/Stkapply/audit_stk_apply',
		method:'POST',
		data:params
		
	})
}



//其他入库单详情
export function getOtherInDetail(params){
	return request({
		url:'/app/StkOtherIn/get_other_in_detail',
		method:'POST',
		data:params
		
	})
}

//其他出库单详情
export function getOtherOutDetail(params){
	return request({
		url:'/app/Stkotherout/get_other_out_detail',
		method:'POST',
		data:params
		
	})
}

//其他出库单审核
export function auditOtherOut(params){
	return request({
		url:'/app/Stkotherout/audit_other_out',
		method:'POST',
		data:params
		
	})
}

//其他入库单审核
export function auditOtherIn(params){
	return request({
		url:'/app/StkOtherIn/audit_other_in',
		method:'POST',
		data:params
		
	})
}




//采购退料单详情
export function getPurReturnDetail(params){
	return request({
		url:'/app/PurReturn/get_pur_return_detail',
		method:'POST',
		data:params
		
	})
}

//采购退料单审核
export function auditPurReturn(params){
	return request({
		url:'/app/PurReturn/audit_pur_return',
		method:'POST',
		data:params
		
	})
}

//工序计划列表
export function getProplanList(params){
	return request({
		url:'/app/SfcProplan/get_plan_list',
		method:'POST',
		data:params
		
	})
}

//工序计划列表(模具归还列表用)
export function getProplanListMoldStatus(params){
	return request({
		url:'/app/SfcProplan/get_plan_list_mold_status',
		method:'POST',
		data:params
		
	})
}

//模具检查列表
export function getMoldMnspectList(params){
	return request({
		url:'/app/MoldInspect/get_mold_inspect_list',
		method:'POST',
		data:params
		
	})
}

//托盘列表
export function getTrayList(params){
	return request({
		url:'/app/Pick/get_tray_list',
		method:'POST',
		data:params
		
	})
}
//机加还没有打印的托盘
export function getJijiaTray(params){
	return request({
		url:'/app/Pick/get_jijia_tray',
		method:'POST',
		data:params
		
	})
}


//工序计划详情（不领料版）
export function getProPlanisDetail(params){
	return request({
		url:'/app/SfcProplan/get_plan_is_detail',
		method:'POST',
		data:params
		
	})
}
//工序汇报详情（不填写版）
export function getOptrptisDetail(params){
	return request({
		url:'/app/SfcOptrpt/get_optrpt_is_detail',
		method:'POST',
		data:params
		
	})
}


//根据托盘查询汇报信息
export function getOptrptByTray(params){
	return request({
		url:'/app/SfcOptrpt/get_optrpt_by_tray',
		method:'POST',
		data:params
		
	})
}

//工序计划详情
export function getProPlanDetail(params){
	return request({
		url:'/app/SfcProplan/get_plan_detail',
		method:'POST',
		data:params
		
	})
}

//根据托盘获取工单号
export function getOperNoByTray(params){
	return request({
		url:'/app/SfcProplan/get_operNo_by_tray',
		method:'POST',
		data:params
		
	})
}


//根据托盘编号查询对应的订单(入库质检和入库时用)
export function getOperNoByTrayInStock(params){
	return request({
		url:'/app/SfcProplan/get_operNo_by_tray_inStock',
		method:'POST',
		data:params
		
	})
}

//审核模具维修
export function auditMoldMain(params){
	return request({
		url:'/app/MoldMaintenance/audit_mold_main',
		method:'POST',
		data:params
		
	})
}

//模具维修详情
export function getMoldMainDetail(params){
	return request({
		url:'/app/MoldMaintenance/get_mold_main_detail',
		method:'POST',
		data:params
		
	})
}



//模具维修列表
export function getMoldMainList(params){
	return request({
		url:'/app/MoldMaintenance/get_mold_main_list',
		method:'POST',
		data:params
		
	})
}

//模具检查详情
export function getMoldInspectDetail(params){
	return request({
		url:'/app/MoldInspect/get_mold_inspect_detail',
		method:'POST',
		data:params
		
	})
}
//检查单领用模具
export function moldInspectPickmold(params){
	return request({
		url:'/app/MoldInspect/mold_inspect_pick_mold',
		method:'POST',
		data:params
		
	})
}

//工序计划详情(模具领用)
export function getProPlanDetailMold(params){
	return request({
		url:'/app/SfcProplan/get_plan_detail_mold',
		method:'POST',
		data:params
		
	})
}

//工序计划详情(模具归还)
export function getProPlanDetailMoldReturn(params){
	return request({
		url:'/app/SfcProplan/get_plan_detail_mold_return',
		method:'POST',
		data:params
		
	})
}

//工序计划详情(补料单)
export function getProPlanDetailFeed(params){
	return request({
		url:'/app/SfcProplan/get_plan_detail_feed',
		method:'POST',
		data:params
		
	})
}



//获取托盘信息
export function getTray(params){
	return request({
		url:'/app/Pick/get_tray',
		method:'POST',
		data:params
		
	})
}

//获取托盘信息(调拨单用)
export function getTrayAllocation(params){
	return request({
		url:'/app/Pick/get_tray_allocation',
		method:'POST',
		data:params
		
	})
}

//获取托盘信息(调拨申请扫码时用)
export function getTrayTransfer(params){
	return request({
		url:'/app/Pick/get_tray_transfer',
		method:'POST',
		data:params
		
	})
}

//获取托盘信息(工序汇报时用)
export function getTrayPlan(params){
	return request({
		url:'/app/Pick/get_tray_plan',
		method:'POST',
		data:params
		
	})
}


//获取模具信息
export function getMold(params){
	return request({
		url:'/app/MoldMaterial/get_mold',
		method:'POST',
		data:params
		
	})
}

//删除临时领用模具的信息
export function deletePickMoldTemp(params){
	return request({
		url:'/app/MoldMaterial/delete_pick_mold_temp',
		method:'POST',
		data:params
		
	})
}


//审核领用模具
export function auditPickMold(params){
	return request({
		url:'/app/MoldMaterial/audit_pick_mold',
		method:'POST',
		data:params
		
	})
}

//工序计划领用模具
export function pickMoldByorderNo(params){
	return request({
		url:'/app/MoldMaterial/pick_mold_by_orderNo',
		method:'POST',
		data:params
		
	})
}

//工序计划归还模具
export function returnMoldByorderNo(params){
	return request({
		url:'/app/MoldMaterial/return_mold_by_orderNo',
		method:'POST',
		data:params
		
	})
}

//添加领料单临时数据
export function createPickDetailTemp(params){
	return request({
		url:'/app/Pick/create_pick_detail_temp',
		method:'POST',
		data:params
		
	})
}

//删除领料单临时数据
export function deletePickDetailTemp(params){
	return request({
		url:'/app/Pick/delete_pick_detail_temp',
		method:'POST',
		data:params
		
	})
}

//删除补料单临时数据
export function deleteFeedDetailTemp(params){
	return request({
		url:'/app/PrdFeed/delete_feed_detail_temp',
		method:'POST',
		data:params
		
	})
}


//保存领料单
export function savePickBill(params){
	return request({
		url:'/app/Pick/create_pick_bill',
		method:'POST',
		data:params
		
	})
}

//保存补料单
export function saveFeedBill(params){
	return request({
		url:'/app/PrdFeed/create_feed_bill',
		method:'POST',
		data:params
		
	})
}


//保存工序汇报单
export function saveReport(params){
	return request({
		url:'/app/SfcOptrpt/create_report',
		method:'POST',
		data:params
		
	})
}

//保存工序汇报单机加车间
export function saveReportJijia(params){
	return request({
		url:'/app/SfcOptrpt/create_report_jijia',
		method:'POST',
		data:params
		
	})
}


//审核工序汇报单
export function auditReport(params){
	return request({
		url:'/app/SfcOptrpt/audit_report',
		method:'POST',
		data:params
		
	})
}


//领料和补料列表用于退料
export function getPrdReturnList(params){
	return request({
		url:'/app/PrdReturn/get_prd_return_list',
		method:'POST',
		data:params
		
	})
}


//添加退料详情数据
export function addPrdReturnDetail(params){
	return request({
		url:'/app/PrdReturn/add_prd_return_detail',
		method:'POST',
		data:params
		
	})
}


//获取退料单详情(临时数据)
export function getPrdReturnTemp(params){
	return request({
		url:'/app/PrdReturn/get_prd_return_temp',
		method:'POST',
		data:params
		
	})
}



//删除补料中的临时数据(临时数据)
export function deleteReturnDetailTemp(params){
	return request({
		url:'/app/PrdReturn/delete_return_detail_temp',
		method:'POST',
		data:params
		
	})
}


//创建退料单
export function saveReturnBill(params){
	return request({
		url:'/app/PrdReturn/create_return_bill',
		method:'POST',
		data:params
		
	})
}


//调拨单列表
export function getTransferList(params){
	return request({
		url:'/app/StkTransfer/get_transfer_list',
		method:'POST',
		data:params
		
	})
}

//创建调拨单
export function createTransfer(params){
	return request({
		url:'/app/StkTransfer/create_transfer',
		method:'POST',
		data:params
		
	})
}

//保存调拨单临时数据
export function createTransferTemp(params){
	return request({
		url:'/app/StkTransfer/create_transfer_temp',
		method:'POST',
		data:params
		
	})
}

//保存调拨单临时数据(调拨单用)
export function createTransferTempByTray(params){
	return request({
		url:'/app/StkTransfer/create_transfer_temp_by_tray',
		method:'POST',
		data:params
		
	})
}

//获取调拨单的临时数据
export function getTransferTemp(params){
	return request({
		url:'/app/StkTransfer/get_transfer_temp',
		method:'POST',
		data:params
		
	})
}


//删除调拨但临时数据
export function deleteTransferTemp(params){
	return request({
		url:'/app/StkTransfer/delete_transfer_temp',
		method:'POST',
		data:params
		
	})
}

//修改托盘数量
export function updateTrayCount(params){
	return request({
		url:'/app/Pick/update_tray_count_by_pda',
		method:'POST',
		data:params
		
	})
}
//创建托盘
export function createTrayPda(params){
	return request({
		url:'/app/Pick/create_tray_pda',
		method:'POST',
		data:params
		
	})
}

//库管创建pda
export function createTrayPdaByKu(params){
	return request({
		url:'/app/Pick/create_tray_pda_by_ku',
		method:'POST',
		data:params
		
	})
}

//合并托盘(库管入库前)
export function mergeTrayPda(params){
	return request({
		url:'/app/PrdInstock/merge_tray_pda',
		method:'POST',
		data:params
		
	})
}


//查询即时库存
export function getInventoryByMaterial(params){
	return request({
		url:'/app/Stkotherout/get_inventory_by_material',
		method:'POST',
		data:params
		
	})
}

//获取流水号
export function getSerial(params){
	return request({
		url:'/app/Serial/get_serial',
		method:'POST',
		data:params
		
	})
}

//修改机加托盘打印状态
export function updateJijiaTray(params){
	return request({
		url:'/app/Pick/update_jijia_tray',
		method:'POST',
		data:params
		
	})
}

//根据uuid获取打印机蓝牙地址
export function getMacByUuid(params){
	return request({
		url:'/app/Pick/get_mac_by_uuid',
		method:'POST',
		data:params
		
	})
}

//推荐仓位
export function commendLocation(params){
	return request({
		url:'/app/Stkapply/commend_location',
		method:'POST',
		data:params
		
	})
}

//根据件号和仓库查询库存
export function commendLocationByItem(params){
	return request({
		url:'/app/Stkapply/commend_location_by_item',
		method:'POST',
		data:params
		
	})
}


//保存领料单(不用扫码的方式)在补料做
export function createFeedTemp(params){
	return request({
		url:'/app/PrdFeed/create_feed_temp',
		method:'POST',
		data:params
		
	})
}


//打印机和pda绑定
export function bandingMacByUuid(params){
	return request({
		url:'/app/Pick/banding_mac_by_uuid',
		method:'POST',
		data:params
		
	})
}

//校验铁托是否存在,是否被占用
export function verifyIronTray(params){
	return request({
		url:'/app/iron/verify_iron_tray',
		method:'POST',
		data:params
		
	})
}


//查询后缀
export function selectSuffix(params){
	return request({
		url:'/app/SfcOptrpt/select_suffix',
		method:'POST',
		data:params
		
	})
}